var a = getApp();

Page({
    data: {
        school_id: 0,
        page: 1,
        isLoadMore: !0,
        total_page: 0,
        listData: [],
        networkLoading: !1
    },
    onLoad: function(a) {
        this.data.school_id = a.school_id, this.getListData();
    },
    onReady: function() {},
    initData: function() {
        this.setData({
            page: 1,
            total_page: 0,
            isLoadMore: !0,
            networkLoading: !1
        });
    },
    getListData: function() {
        var t = this;
        this.initData();
        var o = a.getNetAddresss("plugin.school-company.api.school-center.school-amount");
        a._postNetWork({
            url: o,
            data: {
                school_id: this.data.school_id
            },
            success: function(o) {
                var s = o.data;
                if (1 != s.result) return a.tips(s.msg);
                t.data.total_page = s.data.last_page, t.data.total_page || (t.data.total_page = 0), 
                t.setData({
                    listData: s.data.data,
                    networkLoading: !0
                });
            }
        });
    },
    _getMoreData: function() {
        var t = this;
        if (this.data.isLoadMore = !1, !(this.data.page >= this.data.total_page)) {
            this.data.page += 1;
            var o = a.getNetAddresss("plugin.school-company.api.school-center.school-amount");
            a._postNetWork({
                url: o,
                data: {
                    page: this.data.page,
                    school_id: this.data.school_id
                },
                success: function(a) {
                    var o = a.data;
                    if (t.data.isLoadMore = !0, 1 === o.result) {
                        var s = t.data.listData.concat(o.data.data);
                        t.setData({
                            listData: s
                        });
                    } else t.data.page = t.data.page - 1, t.data.isLoadMore = !1;
                }
            });
        }
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore ? this._getMoreData() : console.log("没有更多数据");
    },
    onShareAppMessage: function() {}
});